<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<meta name="keywords" content="" />
	<meta name="description" content="" /> 
	<link href="/css/bootstrap.min.css" rel="stylesheet">
	<link href="/css/font-awesome.min.css" rel="stylesheet">
	<link rel="stylesheet" href="/css/material-design-iconic-font.min.css">
	<link rel="stylesheet" href="/css/util.css">
	<link rel="stylesheet" href="/css/main.css">
	<style>
		.login100-social-item{
			
		}
		.layui-layer-shade {
		    top: 0;
		    left: 0;
		    width: 0 !important;
		    height: 100%;
		    
		    }
	</style>
	<script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>
</head>
<body>
	<div class="limiter">
		<div class="container-login100" style="background-image: url('/img/bg-01.jpg');">
			<div class="wrap-login100 p-l-55 p-r-55 p-t-65 p-b-54">
				<form class="login100-form validate-form" id="signupForm">
					<span class="login100-form-title p-b-49">登录</span>
					<div class="zhdl">
					<div class="wrap-input100 validate-input m-b-23" data-validate="请输入用户名">
						<span class="label-input100">用户名</span>
						<input class="input100" type="text" name="username" id="username" placeholder="请输入用户名" autocomplete="off">
						<span class="focus-input100" data-symbol="&#xf206;"></span>
					</div>

					<div class="wrap-input100 validate-input" data-validate="请输入密码">
						<span class="label-input100">密码</span>
						<input class="input100" type="password" id="password" name="password"  placeholder="请输入密码">
						<span class="focus-input100" data-symbol="&#xf190;"></span>
					</div>

					<div class="text-right p-t-8 p-b-31">
					</div>

					<div class="container-login100-form-btn">
						<div class="wrap-login100-form-btn">
							<div class="login100-form-bgbtn"></div>
							<button class="login100-form-btn" onclick="login()">登 录</button>
						</div>
					</div>
					</div>
					<!-- 微信登录 -->
					<div class="mtb20 h250 boc" id="ma" style="text-align:center"></div>
					<!-- 微信登录 -->
					<div class="txt1 text-center p-t-54 p-b-20">
					
					</div>

					<div class="flex-c-m">
					</div>

					<div class="flex-col-c p-t-25">
					</div>
				</form>
			</div>
		</div>
	</div>

	
<script th:inline="javascript"> var ctx = [[@{
/}]] ; 
     </script>
<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4" th:src="@{/js/jquery.min.js?v=2.1.4}"></script>
<script src="/js/bootstrap.min.js?v=3.3.6" th:src="@{/js/bootstrap.min.js?v=3.3.6}"></script>

<!-- 自定义js -->
<script src="/js/content.js?v=1.0.0" th:src="@{/js/content.js?v=1.0.0}"></script>
	<script src="/js/main.js"></script>
<!-- jQuery Validation plugin javascript -->
<script src="/js/ajax-util.js"></script>
<script src="/js/plugins/validate/jquery.validate.min.js"
        th:src="@{/js/plugins/validate/jquery.validate.min.js}"></script>
<script src="/js/plugins/validate/messages_zh.min.js" th:src="@{/js/plugins/validate/messages_zh.min.js}"></script>
<script src="/js/plugins/layer/layer.min.js" th:src="@{/js/plugins/layer/layer.min.js}"></script>
<script type="text/javascript">
$("#ma").hide()
    $(document).ready(function () {
        $("#login").on('click', function () {
            $("#signupForm").submit();
        });
        validateRule();
        $("body").keydown(keyDownLogon);
        $("#imgVerify").click();
    });
    	 
   	 $.validator.setDefaults({
       submitHandler: function () {
           login();
       }
    });
    	 
    function login() {
         $.ajax({
            type: "POST",
            url: ctx + "login",
            data: $('#signupForm').serialize(),
            success: function (r) {
                if (r.retCode == 0) {
                    var index = layer.load(1, {
                        shade: [0.1, '#fff'] //0.1透明度的白色背景
                    }); 
                    var dataNum=new Date().valueOf();
                    parent.location.href = '/index?dataNum='+dataNum;
                 } else {
                    layer.msg(r.message);
                }
            },
        }); 
    }

    function keyDownLogon() {
        if (event.keyCode == "13") {
            $("#login").trigger('click');
        }
    }


    function validateRule() {
        var icon = "<i class='fa fa-times-circle'></i> ";
        $("#signupForm").validate({
            rules: {
                username: {
                    required: true
                },
                password: {
                    required: true
                }
            },
            messages: {
                username: {
                    required: icon + "请输入您的用户名",
                },
                password: {
                    required: icon + "请输入您的密码",
                }
            }
        })
    }

    //获取验证码
    function getVerify(obj) {
        obj.src = "/getVerify?" + Math.random();
        console.log(obj)
    }
</script>
</body>
</html> 